﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace House_World
{

    class Helice : Transform
    {
        public VertexPositionColor[] verts;
        BasicEffect moinhoEffect;
        Matrix world;
        public Helice(GraphicsDevice graphicsDevice)
        {
            world = Matrix.Identity;
            verts = new VertexPositionColor[7];
            verts[0] = new VertexPositionColor(new Vector3(1, -1, 0), Color.Red);
            verts[1] = new VertexPositionColor(new Vector3(1, -4, 0), Color.Green);
            verts[2] = new VertexPositionColor(new Vector3(-1, 1, 0), Color.Red);
            verts[3] = new VertexPositionColor(new Vector3(-1, 1, 0), Color.Green);
            verts[4] = new VertexPositionColor(new Vector3(0, 4, 0), Color.Green);

            moinhoEffect = new BasicEffect(graphicsDevice);

        }
        public void Draw(GraphicsDevice graphicsDevice, Camera camera)
        {
            moinhoEffect.World = this.world;
            moinhoEffect.World *= Matrix.CreateTranslation(new Vector3(0, 5, 0));
            moinhoEffect.View = camera.View;
            moinhoEffect.Projection = camera.Projector;
            moinhoEffect.VertexColorEnabled = true;
            foreach (EffectPass pass in moinhoEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                graphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, verts, 0, 2);
            }
        }
        public void Rotate()
        {
            world *= Matrix.CreateRotationZ(0.1f);
        }


    }
}
